package com.itheima.springbootwebtlias.controller;

import com.itheima.springbootwebtlias.pojo.Result;
import com.itheima.springbootwebtlias.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class RepoetController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result jobCount(){
        //1.接受请求参数

        //2.调用业务层方法
        Map map = reportService.jobCount();
        log.info("员工职位信息统计返回结果：" + map);

        //封装返回参数
        return Result.success(map);
    }

    @GetMapping("/empGenderData")
    public Result genderCount(){
        //1.接受请求参数

        //2.调用业务层方法
        List<Map> list = reportService.genderCount();
        log.info("员工性别统计返回结果：" + list);
        //封装返回参数
        return Result.success(list);
    }

    //学院学历统计
    @GetMapping("/studentDegreeData")
    public Result selectDegree(){
        //1.接受请求参数

        //2.调用业务层方法
        List<Map> list = reportService.selectDegree();
        log.info("学员学历信息统计返回结果：" + list);
        //封装返回参数
        return Result.success(list);
    }
    @GetMapping("/studentCountData")
    public Result selectCountData(){
        //1.接受请求参数

        //2.调用业务层方法
        Map map = reportService.selectCountData();
        log.info("班级人数统计返回结果：" + map);
        //封装返回参数
        return Result.success(map);
    }


}
